package com.kaede.hayate.common.base;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableLogic;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.io.Serializable;
import java.util.Date;

public class BaseEntity implements Serializable{

	//	@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)		//WRITE_ONLY仅反序列化(only json to object)
	//	@JsonProperty(access = JsonProperty.Access.READ_ONLY)		//READ_ONLY仅序列化(only object to json)
	
	private static final long serialVersionUID = -3575071783773698201L;

	@JsonProperty(access = JsonProperty.Access.READ_ONLY)
	@TableId("id")
	private Long id;

	@JsonProperty(access = JsonProperty.Access.READ_ONLY)
	@TableField(fill = FieldFill.INSERT)
	private Long createBy;

	@JsonProperty(access = JsonProperty.Access.READ_ONLY)
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@TableField(fill = FieldFill.INSERT)
	private Date createDate;

	@JsonProperty(access = JsonProperty.Access.READ_ONLY)
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private Long updateBy;

	@JsonProperty(access = JsonProperty.Access.READ_ONLY)
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private Date updateDate;

	@JsonIgnore
	@TableLogic
	private Boolean deleteFlag;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getCreateBy() {
		return createBy;
	}

	public void setCreateBy(Long createBy) {
		this.createBy = createBy;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Long getUpdateBy() {
		return updateBy;
	}

	public void setUpdateBy(Long updateBy) {
		this.updateBy = updateBy;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public Boolean getDeleteFlag() {
		return deleteFlag;
	}

	public void setDeleteFlag(Boolean deleteFlag) {
		this.deleteFlag = deleteFlag;
	}
	
	
}
